//
//  AIPolicyNoticeAlert.m
//  Mia
//
//  Created by Vill on 2024/2/20.
//

#import "AIPolicyNoticeAlert.h"

@interface AIPolicyNoticeAlert ()

@property (nonatomic, strong) UIView *containView;
@property (nonatomic, strong) UIButton *closeBtn;
@property (nonatomic, strong) UIImageView *warnImg;   //警告图片
@property (nonatomic, strong) UILabel *firstLbl;      //第一行文本
@property (nonatomic, strong) UILabel *secondLbl;     //第二行文本
@property (nonatomic, strong) UILabel *thirdLbl;      //第三行文本
@property (nonatomic, strong) UILabel *fourthLbl;     //第四行文本

@end

@implementation AIPolicyNoticeAlert

- (instancetype)init{
    self = [super init];
    if (self) {
        self.contentView.backgroundColor = UIColor.clearColor;
        [self.contentView addSubview:self.containView];
        
        [self.contentView addSubview:self.closeBtn];
        [self.contentView addSubview:self.warnImg];
        [self.contentView addSubview:self.firstLbl];
        [self.contentView addSubview:self.secondLbl];
        [self.contentView addSubview:self.thirdLbl];
        [self.contentView addSubview:self.fourthLbl];
        
        [self.containView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.trailing.top.mas_equalTo(self.contentView);
            make.height.mas_equalTo(PTW(580));
            make.bottom.mas_equalTo(self.contentView);
        }];
        [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(PTW(34));
            make.top.mas_equalTo(self.contentView).mas_offset(PTW(15));
            make.trailing.mas_equalTo(self.contentView).mas_offset(-PTW(15));
        }];
        [self.warnImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(PTW(166));
            make.top.mas_equalTo(self.contentView).mas_offset(PTW(10));
            make.centerX.mas_equalTo(self.contentView);
        }];
        [self.firstLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.mas_equalTo(self.contentView).mas_offset(PTW(15));
            make.trailing.mas_equalTo(self.contentView).mas_offset(-PTW(15));
            make.top.mas_equalTo(self.warnImg.mas_bottom);
        }];
        [self.secondLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.mas_equalTo(self.contentView).mas_offset(PTW(15));
            make.trailing.mas_equalTo(self.contentView).mas_offset(-PTW(15));
            make.top.mas_equalTo(self.firstLbl.mas_bottom).mas_offset(PTW(10));
        }];
        [self.thirdLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.mas_equalTo(self.contentView).mas_offset(PTW(15));
            make.trailing.mas_equalTo(self.contentView).mas_offset(-PTW(15));
            make.top.mas_equalTo(self.secondLbl.mas_bottom).mas_offset(PTW(10));
        }];
        [self.fourthLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.mas_equalTo(self.contentView).mas_offset(PTW(15));
            make.trailing.mas_equalTo(self.contentView).mas_offset(-PTW(15));
            make.top.mas_equalTo(self.thirdLbl.mas_bottom).mas_offset(PTW(10));
        }];
        [KIsShowNoticeAlert keySaveToNSDefaultsWithValue:@(YES)];
    }
    return self;
}

// 容器
- (UIView *)containView{
    if(!_containView){
        _containView = [UIView new];
        [_containView setGradientBackgroundWithColors:@[[UIColor colorHex:@"#FDADBC" alpha:1],[UIColor colorHex:@"#834CA8" alpha:1]] locations:@[@0,@1] startPoint:CGPointMake(0,0) endPoint:CGPointMake(0, 1)];
    }
    return _containView;
}

- (UIImageView *)warnImg{
    if(!_warnImg){
        _warnImg = [UIImageView new];
        _warnImg.image = KImaged(@"ai_exclamation_mark");
    }
    return _warnImg;
}

-(UIButton *)closeBtn{
    if(!_closeBtn){
        _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_closeBtn setImage:KImaged(@"ai_main_close") forState:UIControlStateNormal];
        [_closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _closeBtn;
}

- (UILabel *)firstLbl{
    if(!_firstLbl){
        _firstLbl = [UILabel new];
        _firstLbl.textColor = [UIColor colorHex:@"#FFFFFF"];
        _firstLbl.font = [UIFont fontWithWeight:MTBold size:PTW(22)];
        _firstLbl.textAlignment = NSTextAlignmentCenter;
        _firstLbl.numberOfLines = 0;
        _firstLbl.text = @"Let AI psychological \ncounselors know you better \nand help you better";
    }
    return _firstLbl;
}

- (UILabel *)secondLbl{
    if(!_secondLbl){
        _secondLbl = [UILabel new];
        _secondLbl.textColor = [UIColor colorHex:@"#FFFFFF"];
        _secondLbl.font = [UIFont fontWithWeight:Medium size:PTW(14)];
        _secondLbl.textAlignment = NSTextAlignmentCenter;
        _secondLbl.numberOfLines = 0;
        _secondLbl.text = @"The content in the case helps the AI \npsychological counselor fully understand the \nclient's problems and background, so as to \nformulate an appropriate treatment plan. \n\nDuring the psychological consultation process, \nthe AI counselor will further inquire according \nto the specific situation in order to better \nunderstand and help the client.";
    }
    return _secondLbl;
}

- (UILabel *)thirdLbl{
    if(!_thirdLbl){
        _thirdLbl = [UILabel new];
        _thirdLbl.textColor = [UIColor colorHex:@"#FFFFFF"];
        _thirdLbl.font = [UIFont fontWithWeight:MTBold size:PTW(22)];
        _thirdLbl.textAlignment = NSTextAlignmentCenter;
        _thirdLbl.numberOfLines = 0;
        _thirdLbl.text = @"We value your privacy";
    }
    return _thirdLbl;
}

- (UILabel *)fourthLbl{
    if(!_fourthLbl){
        _fourthLbl = [UILabel new];
        _fourthLbl.textColor = [UIColor colorHex:@"#FFFFFF"];
        _fourthLbl.font = [UIFont fontWithWeight:Medium size:PTW(14)];
        _fourthLbl.textAlignment = NSTextAlignmentCenter;
        _fourthLbl.numberOfLines = 0;
        _fourthLbl.text = @"Please note that we will abide by the \nconfidentiality principle to ensure customer \nprivacy and information security.";
    }
    return _fourthLbl;
}

// 确认
-(void)confirmAction{
    [self dismiss];
}

// 关闭
-(void)closeAction{
    [self dismiss];
}

@end
